const express = require("express")
// var cors = require('cors');

const app = express()

// 设置一个变量
app.set('secret','s2d1d5a6fd1f4a')

// 使用跨域模块
app.use(require('cors')())
// app.use(cors());
app.use(express.json())

app.use('/admin', express.static(__dirname + '/admin'))
app.use('/uploads', express.static(__dirname + '/uploads'))

// 引入数据模型,后台管理系统路由
require('./plugins/db')(app)
require('./routes/admin')(app)

app.listen(3000,() => {
  console.log('running...')
})